<!-- 
    @author Wójcik Karol <wojcikk@student.agh.edu.pl>
    @licence http://www.gnu.org/copyleft/gpl.html GNU/GPL
-->

<div id="colOne">
    <%= render :partial => "menu" %>
</div>
<div id="colTwo">
<% if @groups.blank? %>
    <h1>Aktualnie nie ma dost&#281;pnych grup</h1>
<% else %> 
<h1>Grupy</h1>
<p>Masz przypisane:<br/>
<%= "#{@my_groups.size} grup(y)" %>
<table>
<% for lessons_user in @lessons_users %>
<tr>
<td><b><%=h "#{lessons_user.lesson.subject.name} - #{lessons_user.lesson.class_type.name} - (#{lessons_user.lesson.subject.major.name}:#{lessons_user.lesson.subject.year} #{lessons_user.lesson.semestr})" %>:</td>
<td><font color='red'><%=h lessons_user.lgrzaj %></font></td>
</tr>
<% end %>
</table>
</p>

<table>
  <tr>
    <th>Prowadzacy</th>
    <th>Przedmiot</th>
    <th>Typ zajec</th>
    <th>Dzien tygodnia</th>
    <th>Godzina</th>
    <th>Sala</th>
  </tr>
  
<% for group in @groups %>
  <tr>
    <td><%=h "#{group.user.name} #{group.user.surname}" %></td>
    <td><%=h group.lesson.subject.name %></td>    
    <td><%=h group.lesson.class_type.name %></td>
    <td><%=h group.day %></td>
    <td><%=h group.period %></td>
    <td><%=h group.classroom %></td>
        
    <td><%= link_to 'Poka&#380;', :action => 'show', :id => group %></td>
    <td><%= link_to 'Zmie&#324;', :action => 'edit', :id => group %></td>
    <td><%= link_to 'Usu&#324;', { :action => 'destroy', :id => group }, :confirm => 'Are you sure?', :post => true %></td>
  </tr>
<% end %>
</table>

<%= link_to 'Previous page', { :page => @group_pages.current.previous } if @group_pages.current.previous %>
<%= link_to 'Next page', { :page => @group_pages.current.next } if @group_pages.current.next %> 

<br />
<% end %>
<%= link_to 'Utworz nowa', :action => 'new' %>

</div>